import java.io.IOException;
import java.io.InputStream;


public class CounterInputStream extends InputStream {
	
	private InputStream inputStream;
	private long bytesRead;
	
	public CounterInputStream (InputStream inputStream) {
		this.inputStream = inputStream;
	}
	
	@Override
	public int read() throws IOException {
		int value = inputStream.read();
		bytesRead++;
		return value;
	}
	
	public long getBytesRead(){
		return bytesRead;
	}
	
	public void resetCounter(){
		this.bytesRead = 0;
	}

}
